<?php
//eXBcode

function decode_exb($text)
{
	$i=0;

	//strip html
	while(preg_match("#(\[html\])(.*)(\[/html\])#isU", $text, $match) == 1) {
		$text = str_replace($match[0], "[tag".$i."]", $text);
		$tag[$i]=$match[2];
		$i++;
	}
	
	//strip php
	while(preg_match("#(<\?)(.*)(\?>)#isU", $text, $match) == 1) {
		$text = str_replace($match[0], "[tag".$i."]", $text);
		$tag[$i]=$match[0];
		$i++;
	}

	$text=decode_exb_code($text);
	
	//zamiana nowych linii na br'y
	$text = str_replace("\r\n", "\r\n<br />", $text);
	
	for($x=0;$x<$i;$x++) {
		$text = str_replace("[tag".$x."]", $tag[$x], $text);
	}

	return $text;
}

function decode_exb_code($text)
{
	global $conf, $lang;

	//code - powered by GeSHI - http://qbnz.com/highlighter - first part
	$i=0;
	while(preg_match("#\[code(?:=(.*)){0,1}\](.*)[\(\.\*\)]{0}\[/code\]#isU", $text, $code) == 1) {
		include_once('includes/functions/thirdparty/geshi.php');
		if(!$code[1]) $code[1]='html';
		$code[2] = trim($code[2]);
		$code[2] = str_replace("<br />", "\r\n", $code[2]);
		$code[2] = htmlspecialchars($code[2]);
		$geshi = new GeSHi($code[2], $code[1], 'includes/functions/thirdparty/geshi');
		$geshi = $geshi->parse_code();

		$geshi = '<div class="code"><div class="tabelka2"><div class="code_title"><div class="row_3">'.$code[1].'</div></div><div class="code_text"><div class="row_1">'.$geshi.'</div></div></div></div>';
		$g_code[$i]=$geshi;
		$text = str_replace($code[0], '[code'.$i.']', $text);
		$i++;
	}
	//

	//arrays
	$p=array();
	$r=array();

	//bold
	$p[]="#\[b\](.*)\[/b\]#isU";
	$r[]="<b>\\1</b>";
	//

	//italic
	$p[]="#\[i\](.*)\[/i\]#isU";
	$r[]="<i>\\1</i>";
	//

	//underline
	$p[]="#\[u\](.*)\[/u\]#isU";
	$r[]="<u>\\1</u>";
	//

	//size
	$p[]="#\[size=([1-3]?[0-9])\](.*)\[/size\]#isU";
	$r[]="<span style=\"font-size: \\1pt\">\\2</span>";
	//

	//color
	$p[]="#\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[/color\]#isU";
	$r[]="<span style=\"color: \\1\">\\2</span>";
	//

	//url w/o protocol - display link
	$p[]="#\[url\](https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)\[/url\]#isU";
	$r[]="<a href=\"\\1\" target=\"_blank\" class=\"url\">\\1</a>";
	//

	//url w/o protocol - display another text
	$p[]="#\[url=(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)\](.*)\[/url\]#isU";
	$r[]="<a href=\"\\1\" target=\"_blank\" class=\"url\">\\2</a>";
	//

	//class
	$p[]="#\[class=([A-Za-z0-9]+)\](.*)\[/class\]#isU";
	$r[]="<span class=\"\\1\">\\2</span>";
	//

	//email
	$p[]="#\[email\]([^\"']+)@([^\"']+)\[/email\]#isU";
	$r[]="<a href=\"javascript:mail('\\1','\\2');\" class=\"url\">\\1_[at]_\\2</a>";
	//

	//acronyms - help tooltips
	$p[] = "#\[help=([^\"']+)\](.*)\[/help\]#isU";
	$r[] = "<acronym title=\"\\1\">\\2</acronym>";
	//

	//align
	$p[] = "#\[(div|align)=(center|left|right)\](.*)\[/(div|align)\]#isU";
	$r[] = "<div align=\"\\2\">\\3</div>";
	//

	//[#id] - used to create target of scrolling href
	$p[] = "#\[\#([0-9]+)\]#isU";
	$r[] = '<a name="$1"></a>';

	//urls (target self)
	//url w/o protocol - display link
	$p[]="#\[urls\](.*)\[/urls\]#isU";
	$r[]="<a href=\"\\1\" class=\"url\">\\1</a>";
	//

	//url with protocol - display another text
	$p[]="#\[urls=([^\"']+)\](.*)\[/urls\]#isU";
	$r[]="<a href=\"\\1\" class=\"url\">\\2</a>";
	//
	//

	//[you]
	$p[]="#\[you\]#isU";

	if($GLOBALS['get_user_link_by_id']){
		$r[]=$GLOBALS['get_user_link_by_id'];
	}
	elseif($_SESSION['id']){
		$GLOBALS['get_user_link_by_id']=get_user_link_by_id($_SESSION['id']);
		$r[]=$GLOBALS['get_user_link_by_id'];
	}
	else
	$r[]=$lang['guest'];
	//

	$text = preg_replace($p, $r, $text);

	//[#id|anchor|page] - used to create scrolling href
	while(preg_match("#\[\#([0-9]+)\|([^\"']+)\|?([0-9]*)\]#isU", $text, $match) == 1) {
		if($match[3])
			$rec='&amp;rec='.($match[3]-1);
		else
			$rec='';
		
		$text=str_replace($match[0], '<a href="'.ereg_replace('&rec=([0-9])+', '', $_SERVER['REQUEST_URI']).$rec.'#'.$match[1].'" class="scr_href">'.$match[2].'</a>', $text);
	}
	//

	//img
	while(preg_match("#\[img(?:=(right|left|center)){0,1}\]([^\"']+)\[/img\]#isU", $text, $match) == 1) {
		if(strpos($match[2], 'http://')===false) $match[2]=$conf['images_dir'].$match[2];

		$img='<img src="'.$match[2].'" class="'.$match[1].' exbcode_img" onload="scaleImage(this);" alt="" />';

		$text=str_replace($match[0], $img, $text);
	}
	//

	//img_min
	while(preg_match("#\[img_min(?:=(right|left|center)){0,1}\]([^\"']+)\.(jpg|jpeg|png|gif)\[/img_min\]([\t\s\r\n ]*?)#isU", $text, $img)) {
		if($img[1])
			$brs='';
		else
			$brs=$img[4];			
		
		
		$rp="<a href=\"javascript:open_popup('index.php?module=images&amp;function=img_full_size&amp;url=".urlencode($conf['images_dir'].$img[2].'.'.$img[3])."','200','200');\"><img src=\"".$conf['images_min_dir'].md5($img[2].'.'.$img[3]).".".$img[3]."\" class=\"".$img[1]." exbcode_img\" alt=\"\" /></a>".$brs;
		$text = str_replace($img[0], $rp, $text);
	}
	//

	//img_ext
	while(preg_match("#\[img_ext(?:=(right|left|center)){0,1}\]([^\"']+)\.(gif|jpg|jpeg|png)\[/img_ext\]#isU", $text, $img)) {
		global $thm_img;
				
		$rp="<a href=\"javascript:open_popup('index.php?module=images&amp;function=img_full_size&amp;url=".urlencode($img[2].'.'.$img[3])."','200','200');\"><img src=\"".$GLOBALS['theme_path'].$thm_img['img_ext']."\" class=\"".$img[1]." exbcode_img\" alt=\"\" /></a>";
		
		$text = str_replace($img[0], $rp, $text);
	}
	//
	
	//img_gal
	while(preg_match("#\[img_gal(?:=(right|left|center)){0,1}\](?:[\s]{0,})([^\"']+)/([^\"']+)\.(gif|jpg|jpeg|png)(?:[\s]{0,})\[/img_gal\]([\t\s\r\n ]*?)#isU", $text, $img)) {
		
		if($img[1])
			$brs='';
		else
			$brs=$img[4];			
			
		$rp="<a href=\"javascript:open_popup('index.php?function=img_gallery&amp;path=".urlencode($img[2]."/")."&amp;name=".urlencode($img[3].'.'.$img[4])."',screenWH('W'),screenWH('H'));\"><img src=\"".$conf['images_min_dir'].md5($img[2].'/'.$img[3].'.'.$img[4]).'.'.$img[4]."\"".$align." class=\"".$img[1]." exbcode_img\" alt=\"\" /></a>".$brs;
		$text = str_replace($img[0], $rp, $text);
	}
	//

	//flash/swf animation
	while(preg_match("#\[flash\]([^\"']+)\[/flash\]#isU", $text, $swf) == 1)
		$text = str_replace($swf[0], flash($swf[1]), $text);
	//

	//quote
	//quote w/o username - start
	$qo='<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span><b>'.$lang['msg_quote'].'</b></span></td></tr><tr><td class="quote">';
	//quote - end
	$qc='</td></tr></table>';

	while(preg_match("#\[quote\]([^\"']+)\[/quote\]#isU", $text, $match))
		$text = str_replace($match[0], $qo.trim($match[1]).$qc, $text);
	while(preg_match("#\[quote=([^\"']+)\]([^\"']+)\[/quote\]#isU", $text, $match))
		$text = str_replace($match[0], "<table width=\"90%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\"><tr><td><span class=\"body\"><b>".$match[1]." ".$lang['msg_quote_wrote'].":</b></span></td></tr><tr><td class=\"quote\">".trim($match[2]).$qc, $text);
	//

	//lists - [list]
	$offset=0;
	while(($offset=strpos($text, '[list', $offset))!==false) {
		$text_=strtolower($text);
		if(strpos($text_, '[list', $offset+5)!==false) { $offset+=5; $i++; continue; }
		
		if(($type_end=strpos($text_, ']', $offset))>$offset+5)
			$type=substr($text, $offset+5, $type_end-($offset+5));
		else
			$type='';

		$type_end++;
		
		$end_list=strpos($text_, '[/list]', $type_end);
		$list_content=substr($text, $type_end, ($end_list-$type_end));
		
		if($end_list===false)
			break;
			
		if(in_array($type, array('=a', '=i', '=1', '=I', '=A'))) {
			$ls='ol';
			$type_done=' type="'.end($foo=explode("=", $type)).'"';
		}
		else {
			$ls='ul';
			$type_done='';
		}
		
		//add list items * or [*] or -
		$list_content_done=$list_content;
		while(preg_match("#(?:[\r\n|\n|^|\t.| ]{1,})(?:\[\*\]|\*|\-)(.*)(\[\*\]|\*|\[list\]|\[/list\]|<li>|$)#isUm", $list_content_done, $match) == 1)
			$list_content_done = str_replace($match[0], "<li>".trim($match[1])."</li>".$match[2], $list_content_done);
		//
		
		$text=str_replace("[list".$type."]".$list_content."[/list]", "<".$ls.$type_done.">".$list_content_done."</".$ls.">", $text);	
		
		$offset=0;

	}
	//

	//auto link
	$text = preg_replace_callback("#([\n ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&amp;$@\/=\+]+)#si", "exbcode_autolink", $text);
	$text = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&amp;$@\/=\+]*)?)#i", " <a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $text);
	$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"javascript:mail('\\2','\\3');\">\\2 at \\3</a>", $text);
	//

	//code - powered by GeSHI - http://qbnz.com/highlighter - second part
	for($x=0;$x<count($g_code);$x++)
		$text=str_replace('[code'.$x.']', $g_code[$x], $text);
	//

	return $text;
}

function decode_exb_comments($text)
{
	global $lang;

	//code - powered by GeSHI - http://qbnz.com/highlighter - first part
	$i=0;
	while(preg_match("#\[code(?:=(.*)){0,1}\](.*)[\(\.\*\)]{0}\[/code\]#isU", $text, $code) == 1) {
		include_once('includes/functions/thirdparty/geshi.php');
		if(!$code[1]) $code[1]='html';
		$code[2] = trim($code[2]);
		$code[2] = str_replace("<br />", "\r\n", $code[2]);
		$code[2] = htmlspecialchars($code[2]);
		$geshi = new GeSHi($code[2], $code[1], 'includes/functions/thirdparty/geshi');
		$geshi = $geshi->parse_code();

		$geshi = '<div class="code"><div class="tabelka2"><div class="code_title"><div class="row_3">'.$code[1].'</div></div><div class="code_text"><div class="row_1">'.$geshi.'</div></div></div></div>';
		$g_code[$i]=$geshi;
		$text = str_replace($code[0], '[code'.$i.']', $text);
		$i++;
	}
	//

	//arrays
	$p=array();
	$r=array();

	//bold
	$p[]="#\[b\](.*)\[/b\]#isU";
	$r[]="<b>\\1</b>";
	//

	//italic
	$p[]="#\[i\](.*)\[/i\]#isU";
	$r[]="<i>\\1</i>";
	//

	//underline
	$p[]="#\[u\](.*)\[/u\]#isU";
	$r[]="<u>\\1</u>";
	//

	//size
	$p[]="#\[size=([1-3]?[0-9])\](.*)\[/size\]#isU";
	$r[]="<span style=\"font-size: \\1pt\">\\2</span>";
	//

	//color
	$p[]="#\[color=(\#[0-9A-F]{6}|[a-z]+)\](.*)\[/color\]#isU";
	$r[]="<span style=\"color: \\1\">\\2</span>";
	//

	//url w/o protocol - display link
	$p[]="#\[url\](.*)\[/url\]#isU";
	$r[]="<a href=\"\\1\" target=\"_blank\" class=\"url\">\\1</a>";
	//

	//url w/o protocol - display another text
	$p[]="#\[url=(.*)\](.*)\[/url\]#isU";
	$r[]="<a href=\"\\1\" target=\"_blank\" class=\"url\">\\2</a>";
	//

	//email
	$p[]="#\[email\](.*)@(.*)\[/email\]#isU";
	$r[]="<a href=\"javascript:mail('\\1','\\2');\" class=\"post\">\\1 at \\2</a>";
	//

	//align
	$p[] = "#\[(div|align)=(center|left|right)\](.*)\[/(div|align)\]#isU";
	$r[] = "<div align=\"\\2\">\\3</div>";
	//
	
	//[you]
	$p[]="#\[you\]#isU";

	if($GLOBALS['get_user_link_by_id']){
		$r[]=$GLOBALS['get_user_link_by_id'];
	}
	elseif($_SESSION['id']){
		$GLOBALS['get_user_link_by_id']=get_user_link_by_id($_SESSION['id']);
		$r[]=$GLOBALS['get_user_link_by_id'];
	}
	else
		$r[]=$lang['guest'];
	//

	$text = preg_replace($p, $r, $text);

	//img
	while(preg_match("#\[img(?:=(right|left|center)){0,1}\]([[:alnum:]\{\}\?=&amp;;:%\(\)_~\.,/-]+)\[/img\]#isU", $text, $match) == 1) {
		if(strpos($match[2], 'http://')===false) $match[2]=$conf['images_dir'].$match[2];

		$img='<img src="'.$match[2].'" class="'.$match[1].' exbcode_img" onload="scaleImage(this);" alt="" />';

		$text=str_replace($match[0], $img, $text);
	}
	//
	
	//quote
	//quote w/o username - start
	$qo='<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center"><tr><td><span><b>'.$lang['msg_quote'].'</b></span></td></tr><tr><td class="quote">';
	//quote - end
	$qc='</td></tr></table>';

	while(preg_match("#\[quote\](.*)\[/quote\]#isU", $text, $match))
		$text = str_replace($match[0], $qo.trim($match[1]).$qc, $text);
	while(preg_match("#\[quote=(.*)\](.*)\[/quote\]#isU", $text, $match))
		$text = str_replace($match[0], "<table width=\"90%\" cellspacing=\"1\" cellpadding=\"3\" border=\"0\" align=\"center\"><tr><td><span class=\"body\"><b>".$match[1]." ".$lang['msg_quote_wrote'].":</b></span></td></tr><tr><td class=\"quote\">".trim($match[2]).$qc, $text);
	//

	//lists - [list]
	$offset=0;
	$i=0;
	while(($offset=strpos($text, '[list', $offset))!==false) {
		$text_=strtolower($text);
		if(strpos($text_, '[list', $offset+5)!==false) { $offset+=5; $i++; continue; }
		
		if(($type_end=strpos($text_, ']', $offset))>$offset+5)
			$type=substr($text, $offset+5, $type_end-($offset+5));
		else
			$type='';

		$type_end++;
		
		$end_list=strpos($text_, '[/list]', $type_end);
		
		if($end_list===false)
			break;
		
		$list_content=substr($text, $type_end, ($end_list-$type_end));

		if(in_array($type, array('=a', '=i', '=1', '=I', '=A'))) {
			$ls='ol';
			$type_done=' type="'.end($foo=explode("=", $type)).'"';
		}
		else {
			$ls='ul';
			$type_done='';
		}
		
		//add list items * or [*] or -
		$list_content_done=$list_content;
		while(preg_match("#(?:\n|^|\t.|  .)(?:\[\*\]|\*|-)(.*)(\[\*\]|\*|\[list\]|\[/list\]|<li>|$)#isU", $list_content_done, $match) == 1)
			$list_content_done = str_replace($match[0], "<li>".trim($match[1])."</li><br />\n".$match[2], $list_content_done);
		//
		
		$text=str_replace("[list".$type."]".$list_content."[/list]", "<".$ls.$type_done.">".$list_content_done."</".$ls.">", $text);	
		
		$offset=0;

	}
	//

	//auto link
	$text = preg_replace_callback("#([\n|\t ])([a-z]+?)://([a-z0-9\-\.,\?!%\*_\#:;~\\&amp;$@\/=\+]+)#is", "exbcode_autolink", $text);
	$text = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[a-z0-9\-\.,\?!%\*_\#:;~\\&amp;$@\/=\+]*)?)#i", " <a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $text);
	$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"javascript:mail('\\2','\\3');\">\\2 at \\3</a>", $text);
	//

	//code - powered by GeSHI - http://qbnz.com/highlighter - second part
	for($x=0;$x<count($g_code);$x++)
	$text=str_replace('[code'.$x.']', $g_code[$x], $text);
	//

	return $text;
}

function strip_exbcode ($string) {
	$w=array("(\[img_gal(=.*)*\]).*\[\/img_gal\]([\r\n ]*?)*", "\[b\]", "\[\/b\]",  "\[code\]", "\[code=(.+)\]", "\[\/code\]", "\[urls=.+\]", "\[\/url\]",  "\[url\]", "\[\/url\]", "\[url=.+\]", "\[img_ext(=.+)*\].*\[\/img_ext\]", "\[img_ext(=.+)*\]", "\[\/img_ext\]", "\[img_min=.+\].+\[\/img_min\]", "\[img=.+\].+\[\/img\]", "\[img_min=.+\]", "\[\/img_min\]", "\[img=(.+)\]", "\[\/img\]", "\[img\]", "\[i\]", "\[\/i\]", "\[u\]", "\[\/u\]", "\[size=(.+)\]", "\[\/size\]", "\[color=(.+)\]", "\[\/color\]", "\[list(=.+)*\]", "\[\*\]", "\[\/list\]", "\[email\]", "\[\/email\]", "\[quote\]" , "\[quote=.+\]", "\[\/quote\]", "\[end\]", "\[html\]", "\[\/html\]", "<\?", "\?>");

	foreach($w as $x) $string=preg_replace("#".$x."#siU", "", $string);

	return $string;
}

function exbcode_autolink($text)
{
	$lnk=$text[3];
	if(strlen($lnk)>100) {
		if(substr($lnk,0,3)=='www') {
			$e=20;
			$s=3;
		}
		else{
			$e=20;
			$s=0;
		}

		$lnk=substr($lnk,$s,$e).'(...)'.substr($lnk,strlen($lnk)-$e);
	}

	return ' <a href="'.$text[2].'://'.$text[3].'" target="_blank">'.$text[2].'://'.$lnk.'</a>';
}

function flash($swf)
{
	global $conf;
	if(!strpos($swf, 'http://')){
		$name = end($foo = explode('/', $swf));
		$path = str_replace($name, '', $swf);

		$db=new dbquery;
		$db->query("SELECT * FROM $conf[prefix]flash WHERE path='$path' AND name='$name'") or $db->err(__FILE__, __LINE__);
		$a = $db->fetch_object();
		$swf=$conf['images_dir'].$swf;
	}
	else
	$a = NULL;

	return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'.$a->width.'" height="'.$a->height.'" border="'.$a->border.'">
    <param name="movie" value="'.$swf.'">
    <param name="menu" value="'.$a->menu.'">
    <param name="quality" value="high">
    <param name="scale" value="'.$a->scale.'">
    <param name="wmode" value="'.$a->wmode.'">
    <param name="bgcolor" value="'.$a->bgcolor.'">
    <embed src="'.$swf.'" menu="'.$a->menu.'" quality="high" scale="'.$a->scale.'" bgcolor="'.$a->bgcolor.'"  width="'.$a->width.'" height="'.$a->height.'" border="'.$a->border.'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash"></embed></object>';
}

//funkcja zwraca list� tag�w dost�pnych w zale�no�ci od parametru $what (admin -> dot. formularzy wype�nianych w adminie, rest -> dot. komentarzy, forum)
function get_exbcode($what=NULL, $how)
{
	global $lang;
	
	if($what) $what=",".$what."";
	
	if(perms_check('admin', 'html')) {
		$t[]='<a href="javascript:add_content(\'[html]\''.$what.')">[html]</a> - <a href="javascript:add_content(\'[/html]\''.$what.')">[/html]</a>';
		$o[]=$lang['html'];
	}
	
	if(perms_check('admin', 'php')){
		$t[]='<a href="javascript:add_content(\'[php]\''.$what.')">[php]</a> - <a href="javascript:add_content(\'[/php]\''.$what.')">[/php]</a>';
		$o[]=$lang['php'];
	}

	$t[]='<a href="javascript:add_content(\'[you]\''.$what.')">[you]</a>';
	$o[]=$lang['you'];

	$t[]='<a href="javascript:add_content(\'[class=]\''.$what.')">[class=]</a> - <a href="javascript:add_content(\'[/class]\''.$what.')">[/class]</a>';
	$o[]=$lang['class'];

	$t[]='<a href="javascript:add_content(\'[help=]\''.$what.')">[help=]</a> - <a href="javascript:add_content(\'[/help]\''.$what.')">[/help]</a>';
	$o[]=$lang['help'];
	$c[]='admin';

	$t[]='<a href="javascript:add_content(\'[div=]\''.$what.')">[div=]</a> - <a href="javascript:add_content(\'[/div]\''.$what.')">[/div]</a>';
	$o[]=$lang['div'];
	$c[]='admin';

	$t[]='<a href="javascript:add_content(\'[list]\''.$what.')">[list]</a> - <a href="javascript:add_content(\'[/list]\''.$what.')">[/list]</a>';
	$o[]=$lang['list'];
	$c[]='admin';

	for($i=0;$i<count($t);$i++) {
		$r++;
		if($r>2)
		$r=1;

		if(!$c[$i] or perms_check('admin', 'panel'))
			$string.='<tr><td class="row_'.$r.'" width="150">'.$t[$i].'</td><td class="row_'.$r.'">'.$o[$i].'</td></tr>';
	}

	$string='<table border="0" class="tableka2" width="100%">'.$string.'</table>';

	if($how=='echo')
	echo($string);
	if($how=='return')
	return($string);
}
//

//
function get_exbcode_buttons($what) {
	global $lang;
	
	$arr=array();
	
	$arr[]='<input type="button" class="button" value="b" onclick="javascript:exbcode_B('.$what.');" />';
	$arr[]='<input type="button" class="button" value="i" onclick="javascript:exbcode_I('.$what.');" />';
	$arr[]='<input type="button" class="button" value="u" onclick="javascript:exbcode_U('.$what.');" />';
	$arr[]='<br />';
	$arr[]='<input type="button" class="button" value="color" onclick="javascript:exbcode_COLOR('.$what.');" />';
	$arr[]='<input type="button" class="button" value="size" onclick="javascript:exbcode_SIZE('.$what.');" />';
	$arr[]='<br />';
	$arr[]='<input type="button" class="button" value="url" onclick="javascript:exbcode_URL(\'\', \'\', '.$what.');" />';
	if($_GET['module']=='admin')
		$arr[]='<input type="button" class="button" value="urls" onclick="javascript:exbcode_URLS(\'\', \'\', '.$what.');" />';
	$arr[]='<br />';	
	$arr[]='<input type="button" class="button" value="code" onclick="javascript:exbcode_CODE('.$what.');" alt="'.$lang['code'].'" />';
	$arr[]='<input type="button" class="button" value="quote" onclick="javascript:exbcode_QUOTE('.$what.');" />';	
	$arr[]='<br />';
	$arr[]='<input type="button" class="button" value="img=" onclick="javascript:exbcode_IMGA('.$what.');" />';	
	$arr[]='<input type="button" class="button" value="img" onclick="javascript:exbcode_IMG('.$what.');" />';	
	$arr[]='<br />';
	$arr[]='<input type="button" class="button" value="align=" onclick="javascript:exbcode_ALIGN('.$what.');" />';	
	$arr[]='<input type="button" class="button" value="list" onclick="javascript:exbcode_LIST('.$what.');" />';	


	return implode(" ", $arr);
}
?>
